<template>
  <div
    id="app"
    :class="{ 'is-mobile': isMobileDevice }"
  >
    <router-view v-slot="{ Component }">
      <transition
        name="fade"
        mode="out-in"
      >
        <component :is="Component" />
      </transition>
    </router-view>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { isMobile } from './utils/device'

const isMobileDevice = ref(false)

onMounted(() => {
  isMobileDevice.value = isMobile()
})
</script>

<style lang="scss">
#app {
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  &.is-mobile {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style> 